package cn.parllay.dingdangproject.utils;

import android.app.ProgressDialog;
import android.content.Context;

/**
 * Created by sunny on 2018/3/29.
 */

public class LoadingTools {

    private static LoadingTools instance;
    private ProgressDialog pb;

    private LoadingTools(){

    }
    public static LoadingTools getInstance(){
        if(instance == null) {
            synchronized (LoadingTools.class){
                if(instance == null) {
                    instance = new LoadingTools();
                }
            }
        }
        return instance;
    }

    public  void showLoading(Context context,String loadingMsg){
        pb = new ProgressDialog(context);
        pb.setMessage(loadingMsg);
        pb.show();

    }
    public void cancelLoading(){
        if(pb != null) {
            pb.cancel();
        }
    }
}
